package com.scf.fruit.shiro.impl;

import com.scf.fruit.shiro.PermissionDto;
import com.scf.fruit.shiro.PermissionService;
import com.scf.fruit.shiro.RoleDto;
import com.scf.fruit.shiro.dao.PermissionMapper;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import tk.mybatis.mapper.entity.Example;

import javax.annotation.Resource;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

/**
 * @author : 孙超飞
 * @title :
 * @description :
 * @date : 2018-04-23 10:55
 */
@Service
public class PermissionServiceImpl implements PermissionService {
    @Resource
    private PermissionMapper permissionMapper;
    @Override
    public List<PermissionDto> queryPermissionByList(Collection<Long> collection) {
        if(CollectionUtils.isEmpty(collection)){
            return null;
        }else {
            Example example=new Example(PermissionDto.class);
            Example.Criteria criteria=example.createCriteria();
            criteria.andIn("id",collection);
            return permissionMapper.selectByExample(example);
        }

    }
}
